<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_general_ci';
            $table->increments('id');
            $table->string('openid', 50)->comment('openid');
            $table->string('session_key', 50)->comment('session_key');
            $table->string('union_id', 50)->comment('union_id')->nullable();
            $table->string('nick_name', 50)->comment('nick_name')->nullable();
            $table->unsignedTinyInteger('gender')->comment('gender')->nullable();
            $table->string('language', 10)->comment('language')->nullable();
            $table->string('city', 20)->comment('city')->nullable();
            $table->string('province', 20)->comment('province')->nullable();
            $table->string('country', 20)->comment('country')->nullable();
            $table->string('avatar_url', 250)->comment('avatar_url')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
